<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>bosdyn.choreography.client.animation_file_to_proto &mdash; Spot 5.0.1.1 documentation</title>
      <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="../../../../_static/style.css" type="text/css" />
    <link rel="shortcut icon" href="../../../../_static/bd-favicon.png"/>
    <link rel="canonical" href="https://dev.bostondynamics.com/_modules/bosdyn/choreography/client/animation_file_to_proto.html" />
  <!--[if lt IE 9]>
    <script src="../../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="../../../../_static/jquery.js"></script>
        <script src="../../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script>
        <script src="../../../../_static/doctools.js"></script>
        <script src="../../../../_static/sphinx_highlight.js"></script>
    <script src="../../../../_static/js/theme.js"></script>
    <link rel="index" title="Index" href="../../../../genindex.html" />
    <link rel="search" title="Search" href="../../../../search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../../../../README.html">
            
              <img src="../../../../_static/bd-official-white.png" class="logo" alt="Logo"/>
          </a>
              <div class="version">
                5.0.1.1
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../docs/concepts/README.html">Concepts</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/about_spot.html">About Spot</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/orbit/about_orbit.html">About Orbit (formerly Scout)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/orbit/orbit_api.html">Orbit API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/networking.html">Networking</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/base_services.html">Base services</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/geometry_and_frames.html">Geometry and Frames</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/robot_services.html">Robot services</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/estop_service.html">E-Stop</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/keepalive_service.html">KeepAlive (BETA)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/audio_visual.html">Audio Visual</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/lease_service.html">Lease</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/developing_api_services.html">Developing API Services</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/service_customization.html">Service Customization</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/faults.html">Faults</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/autonomy/README.html">Autonomy services</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/graphnav_tech_summary.html">Autonomy Technical Summary</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/autonomous_navigation_code_examples.html">Autonomous navigation code examples</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/components_of_autonomous_navigation.html">Components of autonomous navigation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/docking.html">Docking</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/typical_autonomous_navigation_use_case.html">Typical autonomous navigation use case</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/autonomous_navigation_services.html">Autonomous navigation services</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/graphnav_service.html">GraphNav service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/graphnav_map_structure.html">GraphNav map structure</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/graphnav_area_callbacks.html">GraphNav area callbacks</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/initialization.html">Initialization</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/localization.html">Localization</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/graphnav_and_robot_locomotion.html">GraphNav and robot locomotion</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/missions_service.html">Missions service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/autowalk_service.html">Autowalk service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/network_compute_bridge.html">Network compute bridge</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/auto_return.html">AutoReturn service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/directed_exploration.html">Directed Exploration</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/autonomy/gps.html">GPS</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/choreography/README.html">Choreography</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/choreography_service.html">Choreography Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/move_reference.html">Move Reference Guide</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/custom_gait.html">CustomGait Reference</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/choreographer_setup.html">Choreographer Setup</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/choreographer.html">Choreographer Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/robot_controls_in_choreographer.html">Robot Connections in Choreographer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/animations_in_choreographer.html">Animations in Choreography</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/animation_file_specification.html">Animation File Format</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/choreography_in_tablet.html">Tablet Choreography Mode</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/choreography/choreography_in_autowalk.html">Choreography Actions in Autowalk</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/joint_control/README.html">Joint Control API</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/joint_control/supplemental_data.html">Supplemental Robot Information</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../docs/concepts/joint_control/knee_torque_limits.html">Knee Torque Limits</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/arm/README.html">Spot Arm</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/arm/arm_specification.html">Arm and Gripper Specification</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/arm/arm_concepts.html">Concepts</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/arm/arm_services.html">Services</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/concepts/data.html">Spot Data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/data_acquisition_overview.html">Data Acquisition Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/data_acquisition_output.html">Data Acquisition Output</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/writing_services_for_data_acquisition.html">Integrate Payloads with the API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/data_buffer_overview.html">Data Buffer Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/bddf.html">BDDF File Format</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/concepts/data_acquisition_thermal_raw.html">Thermal Raw Data Format</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../../docs/python/README.html">Python</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/python/quickstart.html">Quickstart</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/python/understanding_spot_programming.html">Understanding Spot Programming</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../python/examples/README.html">Examples</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/basic_service_examples.html">Basic Service Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/hello_spot/README.html">Hello Spot</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/directory/README.html">Directory</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_robot_state/README.html">Get Robot State</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_robot_state_async/README.html">Get Robot State Async</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_image/README.html">Get Image</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_world_objects/README.html">Get World Objects</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_mission_state/README.html">Get Mission State</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/estop/README.html">E-Stop</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/time_sync/README.html">Time Sync</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/comms_test/README.html">Comms Test</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/disable_ir_emission/README.html">IR Enable/Disable</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/reset_safety_stop/README.html">Reset Safety Stop</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/audio_visual/audio_visual_params/README.html">Audio Visual Params</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/audio_visual/audio_visual_behaviors/README.html">Audio Visual Behaviors</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/robot_behavior_examples.html">Robot Behavior and Commands Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/stance/README.html">Stance</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/frame_trajectory_command/README.html">Frame Trajectory</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/spot_light/README.html">Spot Light</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/upload_choreographed_sequence/README.html">Upload Choreographed Sequence</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/xbox_controller/README.html">Xbox Controller</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/wasd/README.html">WASD</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/docking/README.html">Docking</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/animation_recorder/README.html">Animation Recorder</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/auto_return/README.html">Auto Return</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/fan_command/README.html">Fan Commands</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_wasd/README.html">ARM WASD</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/arm_examples.html">Arm Command Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_simple/README.html">Simple Arm Motion</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_stow_unstow/README.html">Stow/unstow Arm</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_freeze/README.html">Arm Freeze</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_and_mobility_command/README.html">Arm and Mobility Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_with_body_follow/README.html">Arm Command with Body Following</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_constrained_manipulation/README.html">Arm Constrained Manipulation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_trajectory/README.html">Arm Trajectory</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_trajectory/README.html#long-trajectory">Long Trajectory</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_joint_move/README.html">Arm Joint Move Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_force_control/README.html">Arm Force Control Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_grasp/README.html">Arm Grasp Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_grasp_carry_overrides/README.html">Arm Grasp and Carry Overrides</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_gaze/README.html">Arm Gaze Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_surface_contact/README.html">Arm Command with Surface Contact</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_door/README.html">Arm Door Opening Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_walk_to_object/README.html">Walk to And Pick Up Object</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_gcode/README.html">Writing Gcode</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/gripper_camera_params/README.html">Gripper Camera Parameters</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_impedance_control/README.html">Arm Impedance Control</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/inverse_kinematics/README.html">Inverse Kinematics</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/arm_wasd/README.html">Arm WASD</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/joint_control/README.html">Wiggle Arm</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/payloads_examples.html">Payloads and Registration Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/payloads/README.html">Payloads</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/self_registration/README.html">Self Registration</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/service_faults/README.html">Faults</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/velodyne_client/README.html">Velodyne</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/core_io_gpio/README.html">CORE I/O GPIO</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/metrics_over_coreio/README.html">Overview</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/metrics_over_coreio/README.html#usage">Usage</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/metrics_over_coreio/README.html#components">Components</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/metrics_over_coreio/README.html#recommended-debugging">Recommended debugging</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/extensions/README.html">Extensions</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/perception_world_objects_examples.html">Perception and World Objects Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_image/README.html">Get Image</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_world_objects/README.html">Get World Objects</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/world_object_with_image_coordinates/README.html">World Object With Image Coordinates</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/world_object_mutations/README.html">World Object Mutations</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/visualizer/README.html">Visualizer</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/gripper_camera_params/README.html">Gripper Camera Parameters</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/spot_cam/README.html">Spot CAM Services</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/spot_cam/README.html#spot-cam-video-core-io-extension-example">Spot Cam Video Core IO Extension Example</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/stitch_front_images/README.html">Stitch Front Images</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_depth_plus_visual_image/README.html">Project Depth Data on Visual Images</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/service_customization/custom_parameter_image_server/README.html">Custom Parameter Image Server</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/fiducial_follow/README.html">Fiducial Follow</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/spot_tensorflow_detector/README.html">Tensorflow Detector</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/service_customization/custom_parameter_ncb_worker/README.html">Custom Parameter Tensorflow Detector</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/network_compute_bridge/README.html">Machine Learning with the Network Compute Bridge</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/network_compute_bridge/fire_extinguisher_server/README.html">Fire Extinguisher Detector with the Network Compute Bridge</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/ray_cast/README.html">Ray Cast</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/user_nogo_regions/README.html">No-Go Regions</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/gps_service/README.html">GPS</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/logging_examples.html">Logging Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/bddf_download/README.html">BDDF Download</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/data_buffer/README.html">Data Buffer</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/data_service/README.html">Data Service</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/logging/README.html">Logging</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/log_status/README.html">Log Status</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/data_acquisition_examples.html">Data Acquisition Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/data_acquisition_service/README.html">Data Acquisition Service</a><ul>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/examples/data_acquisition_service/signals_coreio_modem_plugin/README.html">Modem Signals</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/service_faults/README.html">Faults</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/service_customization/custom_parameter_image_server/README.html">Custom Parameter Image Service</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/service_customization/custom_parameters_data_acquisition/README.html">Custom Parameter Data Acquisition Plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_image/README.html">Test Image Service Implementation with Get Image</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/post_docking_callbacks/README.html">Post Docking Callbacks</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/cloud_upload/README.html">Cloud Upload</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/comms_mapping/README.html">Comms image service</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/comms_mapping/README.html#how-to-use">How to use</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/data_acquisition_service/signals_coreio_modem_plugin/README.html">CoreIO Modem Signals Plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/tester_programs/README.html">Tester Programs</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/autonomy_and_missions_examples.html">Autonomy and Missions Examples</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/graph_nav_anchoring_optimization/README.html">Graph Nav Anchoring Optimization</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/graph_nav_command_line/README.html">GraphNav and Recording Service Command Line Interfaces</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/graph_nav_command_line/README.html#example-programs">Example Programs</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/graph_nav_extract_point_cloud/README.html">Graph Nav Extract Point Cloud</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/graph_nav_view_map/README.html">Graph Nav View Map</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/graph_nav_view_gps/README.html">Graph Nav View GPS Data</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/get_mission_state/README.html">Get Mission State</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/remote_mission_service/README.html">Remote Mission Service</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/mission_question_answerer/README.html">Mission Question Answerer</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/mission_recorder/README.html">Mission Recorder</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/replay_mission/README.html">Replay Mission</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/post_docking_callbacks/README.html">Post Docking Callbacks</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/area_callback/README.html">Area Callbacks</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/edit_autowalk/README.html">Edit Autowalk</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/record_autowalk/README.html">Record Autowalk</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/extract_images_from_walk/README.html">Extract Images from Autowalk</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/network_request_callback/README.html">Network Request Callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/network_request_callback/README.html#id1">Network Request Callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/remote_mission_service/spot_check/README.html">SpotCheck Mission Service</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/joint_control_examples.html">Joint Control API Examples</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/examples/docs/orbit.html">Orbit</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/hello_orbit/README.html">Hello Orbit</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/export_run_archives/README.html">Export Run Archives</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/export_site_walk_archives/README.html">Export Sitewalk Archives</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/anomalies/README.html">Anomalies</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/schedule_mission/README.html">Schedule Mission</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/runs_response/README.html">Runs Response</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/send_robot_back_to_dock/README.html">Return to Dock</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/toggle_mission_based_on_weather/README.html">Mission Toggle</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/webhook/README.html">Webhook</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/backups/README.html">Backups</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/webhook_integration/README.html">Webhook Integrations</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/examples/orbit/webhook_integration/README.html#example-overview">Example Overview</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../python/README.html">Python Reference Guide</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/README.html">Client</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/area_callback.html">Area Callback</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/area_callback_region_handler_base.html">Area Callback Region Handler</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/area_callback_service_runner.html">Area Callback Service Runner</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/area_callback_service_servicer.html">Area Callback Servicer</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/area_callback_service_utils.html">Area Callback Service Utils</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/arm_surface_contact.html">Arm Surface Contact</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/async_tasks.html">Async Tasks</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/audio_visual.html">Audio Visual</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/audio_visual_helpers.html">Audio Visual Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/auth.html">Auth</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/auto_return.html">Auto Return</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/autowalk.html">Autowalk</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/bddf.html">BDDF</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/bddf_download.html">BDDF Download</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/channel.html">Channel</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/command_line.html">Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/common.html">Common</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_acquisition.html">Data Acquisition</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_acquisition_helpers.html">Data Acquisition Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_acquisition_plugin.html">Data Acquisition Plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_acquisition_plugin_service.html">Data Acquisition Plugin Service</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_acquisition_store.html">Data Acquisition Store</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_buffer.html">Data Buffer</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_chunk.html">Data Chunk</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/data_service.html">Data Service</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/directory_registration.html">Directory Registration</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/directory.html">Directory</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/docking.html">Docking</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/door.html">Door</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/estop.html">E-Stop</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/error_callback_result.html">Error Callback Result</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/exceptions.html">Exceptions</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/fault.html">Fault</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/frame_helpers.html">Frame Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/graph_nav.html">Graph Nav</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gripper_camera_param.html">Gripper Camera Params</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gps/README.html">GPS</a><ul>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gps/aggregator_client.html">Aggregator Client</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gps/gps_listener.html">GPS Listener</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gps/NMEAParser.html">NMEA Parser</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gps/ntrip_client.html">NTRIP Client</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/gps/registration_client.html">Registration Client</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/image.html">Image</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/image_service_helpers.html">Image Service Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/inverse_kinematics.html">Inverse Kinematics</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/ir_enable_disable.html">IR Enable/Disable</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/keepalive.html">Keep Alive</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/lease.html">Lease</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/lease_resource_hierarchy.html">Lease Resource Hierarchy</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/lease_validator.html">Lease Validator</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/license.html">License</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/local_grid.html">Local Grid</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/log_status.html">Log Status</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/math_helpers.html">Math Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/manipulation_api_client.html">Manipulation API</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/map_processing.html">Map Processing</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/metrics_logging.html">Metrics Logging</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/network_compute_bridge_client.html">Network Compute Bridge</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/payload_registration.html">Payload Registration</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/payload_software_update.html">Payload Software Update</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/payload_software_update_initiation.html">Payload Software Update Initiation</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/payload.html">Payload</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/point_cloud.html">Point Cloud</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/power.html">Power</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/processors.html">Processors</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/ray_cast.html">Ray casting</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/recording.html">Recording</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/robot_command.html">Robot Command</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/robot_id.html">Robot ID</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/robot.html">Robot</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/robot_state.html">Robot State</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/sdk.html">SDK</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/server_util.html">Server Util</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/service_customization_helpers.html">Service Customization Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/signals_helpers.html">Signals Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/README.html">Spot CAM</a><ul>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/audio.html">Audio</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/compositor.html">Compositor</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/health.html">Health</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/lighting.html">Lighting</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/lights_helper.html">Lights Helper</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/media_log.html">Media Log</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/network.html">Network</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/power.html">Power</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/ptz.html">PTZ</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/streamquality.html">Stream Quality</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_cam/version.html">Version</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/spot_check.html">Spot Check</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/time_sync.html">Time Sync</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/token_cache.html">Token Cache</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/token_manager.html">Token Manager</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/units_helpers.html">Units Helpers</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/util.html">Util</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-client/src/bosdyn/client/world_object.html">World Object</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/README.html">Core</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/README.html">BDDF</a><ul>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/base_data_reader.html">Base Data Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/block_writer.html">Block Writer</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/bosdyn.html">BDDF Conventions</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/common.html">Common</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/data_reader.html">Data Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/data_writer.html">Data Writer</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/file_indexer.html">File Indexer</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/grpc_proto_reader.html">GRPC Proto Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/grpc_reader.html">GRPC Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/grpc_service_reader.html">GRPC Service Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/grpc_service_writer.html">GRPC Service Writer</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/message_reader.html">Message Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/pod_series_reader.html">POD Series Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/pod_series_writer.html">POD Series Writer</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/protobuf_channel_reader.html">Protobuf Channel Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/protobuf_reader.html">Protobuf Reader</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/protobuf_series_writer.html">Protobuf Series Writer</a></li>
<li class="toctree-l5"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/bddf/stream_data_reader.html">Stream Data Reader</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/geometry.html">Geometry</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/util.html">Util</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-core/src/bosdyn/deprecated.html">Deprecated</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/README.html">Mission</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/client.html">Client</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/constants.html">Constants</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/exceptions.html">Exceptions</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/remote_client.html">Remote Client</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/server_util.html">Server Util</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-mission/src/bosdyn/mission/util.html">Util</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/README.html">Choreography</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/choreography.html">Choreography</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html">Animation File to Proto</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_conversion_helpers.html">Animation File to Proto Helpers</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/bosdyn-orbit/src/bosdyn/orbit/README.html">Orbit (formerly Scout)</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-orbit/src/bosdyn/orbit/client.html">Client</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-orbit/src/bosdyn/orbit/utils.html">Utils</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-orbit/src/bosdyn/orbit/exceptions.html">Exceptions</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../../../python/bosdyn-scout/src/bosdyn/scout/README.html">Scout (deprecated)</a><ul>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-scout/src/bosdyn/scout/client.html">Client</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-scout/src/bosdyn/scout/utils.html">Utils</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../../../python/bosdyn-scout/src/bosdyn/scout/exceptions.html">Exceptions</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/python/fetch_tutorial/fetch1.html">Fetch Tutorial</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/fetch_tutorial/fetch2.html">Part 2: Training the Model</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/fetch_tutorial/fetch3.html">Part 3: Evaluating the Model</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/fetch_tutorial/fetch4.html">Part 4: Autonomous Pick Up</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/fetch_tutorial/fetch5.html">Part 5: Detecting People and Playing Fetch</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/fetch_tutorial/fetch6.html">Part 6: Running the model on Core IO</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/python/daq_tutorial/daq1.html">Data Collection Tutorial</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/daq_tutorial/daq2.html">Part 2: Capturing images</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/daq_tutorial/daq3.html">Part 3: Capturing other data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/daq_tutorial/daq4.html">Part 4: Deploying to the CORE I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/daq_tutorial/daq5.html">Part 5: Collecting data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/python/daq_tutorial/daq6.html">Part 6: Processing collected data</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../../docs/payload/README.html">Payloads</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/payload_configuration_requirements.html">Payload configuration requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/mechanical_interfaces.html">Mechanical interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/robot_mounting_rails.html">Robot mounting rails</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/guidelines_for_robust_payload_design.html">Guidelines for robust payload design</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/robot_electrical_interface.html">Robot electrical interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/coreio_documentation.html">CORE I/O Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/coreio_openvpn_extension.html">CORE I/O OpenVPN Extension</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/configuring_payload_software.html">Configuring payload software</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/docker_containers.html">Dockerize payload software</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/payload/spot_core_documentation.html">Pre-3.2 Spot CORE Documentation</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/payload/spot_core_portainer.html">Configuring Docker containers in SpotCORE</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/payload/spot_core_cockpit.html">Spot CORE system management tool: Cockpit</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../../docs/payload/spot_core_vnc.html">Spot CORE VNC</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../../docs/protos/README.html">API Protocol</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../../../../docs/protos/style_guide.html">Style Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../../protos/bosdyn/api/README.html">Proto Reference Guide</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../../../../protos/bosdyn/api/proto_reference.html">Protos</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../../docs/release_notes.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/boston-dynamics/spot-sdk">SDK Repository</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../../README.html">Spot</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../../README.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../../index.html">Module code</a></li>
      <li class="breadcrumb-item active">bosdyn.choreography.client.animation_file_to_proto</li>
      <li class="wy-breadcrumbs-aside">
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <h1>Source code for bosdyn.choreography.client.animation_file_to_proto</h1><div class="highlight"><pre>
<span></span><span class="c1"># Copyright (c) 2023 Boston Dynamics, Inc.  All rights reserved.</span>
<span class="c1">#</span>
<span class="c1"># Downloading, reproducing, distributing or otherwise using the SDK Software</span>
<span class="c1"># is subject to the terms and conditions of the Boston Dynamics Software</span>
<span class="c1"># Development Kit License (20191101-BDSDK-SL).</span>

<span class="sd">&quot;&quot;&quot;A tool to convert animation files into protobuf messages which can be uploaded to the robot</span>
<span class="sd">and used within choreography sequences.&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">argparse</span>
<span class="kn">import</span> <span class="nn">hashlib</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">ntpath</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">sys</span>

<span class="kn">from</span> <span class="nn">google.protobuf</span> <span class="kn">import</span> <span class="n">text_format</span><span class="p">,</span> <span class="n">wrappers_pb2</span>

<span class="kn">import</span> <span class="nn">bosdyn.client</span>
<span class="kn">import</span> <span class="nn">bosdyn.client.util</span>
<span class="kn">from</span> <span class="nn">bosdyn.api.spot</span> <span class="kn">import</span> <span class="n">choreography_sequence_pb2</span>
<span class="kn">from</span> <span class="nn">bosdyn.choreography.client.animation_file_conversion_helpers</span> <span class="kn">import</span> <span class="o">*</span>

<span class="n">LOGGER</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>

<span class="c1"># The options keywords represent the first section of the file, and will be parsed into</span>
<span class="c1"># specific fields within the Animation proto.</span>
<span class="n">OPTIONS_KEYWORDS_TO_FUNCTION</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s2">&quot;controls&quot;</span><span class="p">:</span> <span class="n">controls_option</span><span class="p">,</span>
    <span class="s2">&quot;bpm&quot;</span><span class="p">:</span> <span class="n">bpm_option</span><span class="p">,</span>
    <span class="s2">&quot;extendable&quot;</span><span class="p">:</span> <span class="n">extendable_option</span><span class="p">,</span>
    <span class="s2">&quot;truncatable&quot;</span><span class="p">:</span> <span class="n">truncatable_option</span><span class="p">,</span>
    <span class="s2">&quot;neutral_start&quot;</span><span class="p">:</span> <span class="n">neutral_start_option</span><span class="p">,</span>
    <span class="s2">&quot;precise_steps&quot;</span><span class="p">:</span> <span class="n">precise_steps_option</span><span class="p">,</span>
    <span class="s2">&quot;precise_timing&quot;</span><span class="p">:</span> <span class="n">precise_timing_option</span><span class="p">,</span>  <span class="c1"># Deprecated.</span>
    <span class="s2">&quot;timing_adjustability&quot;</span><span class="p">:</span> <span class="n">timing_adjustability_option</span><span class="p">,</span>
    <span class="s2">&quot;no_looping&quot;</span><span class="p">:</span> <span class="n">no_looping_option</span><span class="p">,</span>
    <span class="s2">&quot;arm_required&quot;</span><span class="p">:</span> <span class="n">arm_required_option</span><span class="p">,</span>
    <span class="s2">&quot;arm_prohibited&quot;</span><span class="p">:</span> <span class="n">arm_prohibited_option</span><span class="p">,</span>
    <span class="s2">&quot;starts_sitting&quot;</span><span class="p">:</span> <span class="n">starts_sitting_option</span><span class="p">,</span>
    <span class="s2">&quot;track_swing_trajectories&quot;</span><span class="p">:</span> <span class="n">track_swing_trajectories_option</span><span class="p">,</span>
    <span class="s2">&quot;assume_zero_roll_and_pitch&quot;</span><span class="p">:</span> <span class="n">assume_zero_roll_and_pitch_option</span><span class="p">,</span>
    <span class="s2">&quot;arm_playback&quot;</span><span class="p">:</span> <span class="n">arm_playback_option</span><span class="p">,</span>
    <span class="s2">&quot;display_rgb&quot;</span><span class="p">:</span> <span class="n">display_rgb_option</span><span class="p">,</span>
    <span class="s2">&quot;frequency&quot;</span><span class="p">:</span> <span class="n">frequency_option</span><span class="p">,</span>
    <span class="s2">&quot;retime_to_integer_slices&quot;</span><span class="p">:</span> <span class="n">retime_to_integer_slices_option</span><span class="p">,</span>
    <span class="s2">&quot;description&quot;</span><span class="p">:</span> <span class="n">description_option</span><span class="p">,</span>
    <span class="s2">&quot;custom_gait_cycle&quot;</span><span class="p">:</span> <span class="n">custom_gait_cycle_option</span><span class="p">,</span>
<span class="p">}</span>

<span class="c1"># The grouped headers represent animation keyframe values which can be used and specify multiple protobuf</span>
<span class="c1"># values for a single header keyword. For example, body_pos has x/y/z position values.</span>
<span class="n">GROUPED_HEADERS</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s2">&quot;body_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">body_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;com_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">com_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;body_euler_rpy&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">body_euler_rpy_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;body_quat_xyzw&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">body_quaternion_xyzw_handler</span><span class="p">),</span>
    <span class="s2">&quot;body_quat_wxyz&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">body_quaternion_wxyz_handler</span><span class="p">),</span>
    <span class="s2">&quot;leg_joints&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">12</span><span class="p">,</span> <span class="n">leg_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;foot_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">12</span><span class="p">,</span> <span class="n">foot_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;hand_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hand_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;hand_euler_rpy&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hand_euler_rpy_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;hand_quat_xyzw&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">hand_quaternion_xyzw_handler</span><span class="p">),</span>
    <span class="s2">&quot;hand_quat_wxyz&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">hand_quaternion_wxyz_handler</span><span class="p">),</span>
    <span class="s2">&quot;contact&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="n">contact_handler</span><span class="p">),</span>
    <span class="s2">&quot;arm_joints&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="n">arm_joints_handler</span><span class="p">),</span>
    <span class="s2">&quot;fl_angles&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">fl_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;fr_angles&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">fr_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;hl_angles&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hl_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;hr_angles&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hr_angles_handler</span><span class="p">),</span>
    <span class="s2">&quot;fl_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">fl_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;fr_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">fr_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;hl_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hl_pos_handler</span><span class="p">),</span>
    <span class="s2">&quot;hr_pos&quot;</span><span class="p">:</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="n">hr_pos_handler</span><span class="p">),</span>
<span class="p">}</span>

<span class="c1"># The single grouped headers represent animation keyframe values which can be used and specify a single</span>
<span class="c1"># protobuf value for the header keyword.</span>
<span class="n">SINGLE_HEADERS</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s2">&quot;body_x&quot;</span><span class="p">:</span> <span class="n">body_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_y&quot;</span><span class="p">:</span> <span class="n">body_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_z&quot;</span><span class="p">:</span> <span class="n">body_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;com_x&quot;</span><span class="p">:</span> <span class="n">com_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;com_y&quot;</span><span class="p">:</span> <span class="n">com_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;com_z&quot;</span><span class="p">:</span> <span class="n">com_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_quat_w&quot;</span><span class="p">:</span> <span class="n">body_quat_w_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_quat_x&quot;</span><span class="p">:</span> <span class="n">body_quat_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_quat_y&quot;</span><span class="p">:</span> <span class="n">body_quat_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_quat_z&quot;</span><span class="p">:</span> <span class="n">body_quat_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_roll&quot;</span><span class="p">:</span> <span class="n">body_roll_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_pitch&quot;</span><span class="p">:</span> <span class="n">body_pitch_handler</span><span class="p">,</span>
    <span class="s2">&quot;body_yaw&quot;</span><span class="p">:</span> <span class="n">body_yaw_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_hx&quot;</span><span class="p">:</span> <span class="n">fl_hx_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_hy&quot;</span><span class="p">:</span> <span class="n">fl_hy_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_kn&quot;</span><span class="p">:</span> <span class="n">fl_kn_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_hx&quot;</span><span class="p">:</span> <span class="n">fr_hx_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_hy&quot;</span><span class="p">:</span> <span class="n">fr_hy_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_kn&quot;</span><span class="p">:</span> <span class="n">fr_kn_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_hx&quot;</span><span class="p">:</span> <span class="n">hl_hx_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_hy&quot;</span><span class="p">:</span> <span class="n">hl_hy_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_kn&quot;</span><span class="p">:</span> <span class="n">hl_kn_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_hx&quot;</span><span class="p">:</span> <span class="n">hr_hx_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_hy&quot;</span><span class="p">:</span> <span class="n">hr_hy_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_kn&quot;</span><span class="p">:</span> <span class="n">hr_kn_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_x&quot;</span><span class="p">:</span> <span class="n">fl_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_y&quot;</span><span class="p">:</span> <span class="n">fl_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_z&quot;</span><span class="p">:</span> <span class="n">fl_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_x&quot;</span><span class="p">:</span> <span class="n">fr_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_y&quot;</span><span class="p">:</span> <span class="n">fr_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_z&quot;</span><span class="p">:</span> <span class="n">fr_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_x&quot;</span><span class="p">:</span> <span class="n">hr_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_y&quot;</span><span class="p">:</span> <span class="n">hr_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_z&quot;</span><span class="p">:</span> <span class="n">hr_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_x&quot;</span><span class="p">:</span> <span class="n">hl_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_y&quot;</span><span class="p">:</span> <span class="n">hl_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_z&quot;</span><span class="p">:</span> <span class="n">hl_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;fl_contact&quot;</span><span class="p">:</span> <span class="n">fl_contact_handler</span><span class="p">,</span>
    <span class="s2">&quot;fr_contact&quot;</span><span class="p">:</span> <span class="n">fr_contact_handler</span><span class="p">,</span>
    <span class="s2">&quot;hl_contact&quot;</span><span class="p">:</span> <span class="n">hl_contact_handler</span><span class="p">,</span>
    <span class="s2">&quot;hr_contact&quot;</span><span class="p">:</span> <span class="n">hr_contact_handler</span><span class="p">,</span>
    <span class="s2">&quot;shoulder0&quot;</span><span class="p">:</span> <span class="n">sh0_handler</span><span class="p">,</span>
    <span class="s2">&quot;shoulder1&quot;</span><span class="p">:</span> <span class="n">sh1_handler</span><span class="p">,</span>
    <span class="s2">&quot;elbow0&quot;</span><span class="p">:</span> <span class="n">el0_handler</span><span class="p">,</span>
    <span class="s2">&quot;elbow1&quot;</span><span class="p">:</span> <span class="n">el1_handler</span><span class="p">,</span>
    <span class="s2">&quot;wrist0&quot;</span><span class="p">:</span> <span class="n">wr0_handler</span><span class="p">,</span>
    <span class="s2">&quot;wrist1&quot;</span><span class="p">:</span> <span class="n">wr1_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_x&quot;</span><span class="p">:</span> <span class="n">hand_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_y&quot;</span><span class="p">:</span> <span class="n">hand_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_z&quot;</span><span class="p">:</span> <span class="n">hand_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_quat_w&quot;</span><span class="p">:</span> <span class="n">hand_quat_w_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_quat_x&quot;</span><span class="p">:</span> <span class="n">hand_quat_x_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_quat_y&quot;</span><span class="p">:</span> <span class="n">hand_quat_y_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_quat_z&quot;</span><span class="p">:</span> <span class="n">hand_quat_z_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_roll&quot;</span><span class="p">:</span> <span class="n">hand_roll_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_pitch&quot;</span><span class="p">:</span> <span class="n">hand_pitch_handler</span><span class="p">,</span>
    <span class="s2">&quot;hand_yaw&quot;</span><span class="p">:</span> <span class="n">hand_yaw_handler</span><span class="p">,</span>
    <span class="s2">&quot;gripper&quot;</span><span class="p">:</span> <span class="n">gripper_handler</span><span class="p">,</span>
    <span class="s2">&quot;time&quot;</span><span class="p">:</span> <span class="n">start_time_handler</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">COMMENT_DELIMITERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;//&quot;</span><span class="p">,</span> <span class="s2">&quot;#&quot;</span><span class="p">]</span>


<div class="viewcode-block" id="AnimationFileFormatError"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.AnimationFileFormatError">[docs]</a><span class="k">class</span> <span class="nc">AnimationFileFormatError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Specific Exception raised when we identify an issue with an animation (.cha) file.&quot;&quot;&quot;</span>
    <span class="k">pass</span></div>


<div class="viewcode-block" id="Animation"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.Animation">[docs]</a><span class="k">class</span> <span class="nc">Animation</span><span class="p">():</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Helper class to track values read from the animation file that are important to choreographer</span>
<span class="sd">    and necessary when uploading animated moves.&quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="c1"># The name of the animated move.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="c1"># [Optional] The BPM which the move will be performed at.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bpm</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="c1"># [Optional] The frequency at which the keyframes occur. If not provided in the CHA file, then</span>
        <span class="c1"># explicit timestamps must be provided for each keyframe.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">frequency</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="c1"># Default description for the animated move.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="s2">&quot;Animated dance move.&quot;</span>

        <span class="c1"># The protobuf message representing the animation.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">proto</span> <span class="o">=</span> <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">Animation</span><span class="p">()</span>

        <span class="c1"># The color of the animated move&#39;s block when loaded in Choreographer.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">rgb</span> <span class="o">=</span> <span class="p">[</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">]</span>

        <span class="c1"># Each individual parameter line as read from a *.cha file.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">parameter_lines</span> <span class="o">=</span> <span class="p">[]</span>

<div class="viewcode-block" id="Animation.create_move_info_proto"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.Animation.create_move_info_proto">[docs]</a>    <span class="k">def</span> <span class="nf">create_move_info_proto</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w">        </span><span class="sd">&quot;&quot;&quot;Creates the MoveInfo protobuf message from the parsed animation file.</span>

<span class="sd">        Returns:</span>
<span class="sd">            The choreography_sequence.MoveInfo protobuf message for the animation as generated</span>
<span class="sd">            by the different animation fields in the Animation proto.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">move_info</span> <span class="o">=</span> <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">MoveInfo</span><span class="p">()</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">is_extendable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">extendable</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">truncatable</span>  <span class="c1"># &quot;is adjustable&quot;</span>

        <span class="c1"># Should always have move.time, so the duration is the final time of the last frame.</span>
        <span class="n">move_duration_sec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">animation_keyframes</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">time</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">bpm</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
            <span class="c1"># Compute the move length slices using the bpm.</span>
            <span class="n">slices_per_minute</span> <span class="o">=</span> <span class="mi">4</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">bpm</span>
            <span class="n">move_duration_minutes</span> <span class="o">=</span> <span class="n">move_duration_sec</span> <span class="o">/</span> <span class="mf">60.0</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">move_length_slices</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">move_duration_minutes</span> <span class="o">*</span> <span class="n">slices_per_minute</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="c1"># Just use the time to size the move.</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">move_length_time</span> <span class="o">=</span> <span class="n">move_duration_sec</span>

        <span class="c1"># Set the max/min info based on truncatable/extendable flags.</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">truncatable</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">extendable</span><span class="p">:</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">max_time</span> <span class="o">=</span> <span class="n">move_info</span><span class="o">.</span><span class="n">move_length_time</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">max_move_length_slices</span> <span class="o">=</span> <span class="n">move_info</span><span class="o">.</span><span class="n">move_length_slices</span>
        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">extendable</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">truncatable</span><span class="p">:</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">min_time</span> <span class="o">=</span> <span class="n">move_info</span><span class="o">.</span><span class="n">move_length_time</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">min_move_length_slices</span> <span class="o">=</span> <span class="n">move_info</span><span class="o">.</span><span class="n">move_length_slices</span>

        <span class="c1"># Set the different track information</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">controls_arm</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">controls_arm</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">controls_gripper</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">controls_gripper</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">controls_legs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">controls_legs</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">controls_body</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">controls_body</span>

        <span class="c1"># Set the choreographer-specific display information</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">category</span> <span class="o">=</span> <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">ChoreographerDisplayInfo</span><span class="o">.</span><span class="n">CATEGORY_ANIMATION</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">color</span><span class="o">.</span><span class="n">r</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rgb</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">color</span><span class="o">.</span><span class="n">g</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rgb</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">color</span><span class="o">.</span><span class="n">b</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rgb</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">color</span><span class="o">.</span><span class="n">a</span> <span class="o">=</span> <span class="mf">1.0</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">display</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">description</span>

        <span class="c1"># Animations are required to start and end in a standing position (by default).</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">starts_sitting</span><span class="p">:</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">entrance_states</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
                <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">MoveInfo</span><span class="o">.</span><span class="n">TRANSITION_STATE_SIT</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">move_info</span><span class="o">.</span><span class="n">entrance_states</span><span class="o">.</span><span class="n">append</span><span class="p">(</span>
                <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">MoveInfo</span><span class="o">.</span><span class="n">TRANSITION_STATE_STAND</span><span class="p">)</span>
        <span class="n">move_info</span><span class="o">.</span><span class="n">exit_state</span> <span class="o">=</span> <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">MoveInfo</span><span class="o">.</span><span class="n">TRANSITION_STATE_STAND</span>

        <span class="k">return</span> <span class="n">move_info</span></div></div>


<div class="viewcode-block" id="set_proto"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.set_proto">[docs]</a><span class="k">def</span> <span class="nf">set_proto</span><span class="p">(</span><span class="n">proto_object</span><span class="p">,</span> <span class="n">attribute_name</span><span class="p">,</span> <span class="n">attribute_value</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Helper function to set a field to a specific value in the protobuf message.</span>

<span class="sd">    Args:</span>
<span class="sd">        proto_object (Protobuf message): Any generic protobuf message.</span>
<span class="sd">        attribute_name (String): The field name within the protobuf message.</span>
<span class="sd">        attribute_value: A value with type matching the field type defined in the protobuf</span>
<span class="sd">            message definition. This will be saved in the attribute_name field.</span>

<span class="sd">    Returns:</span>
<span class="sd">        Nothing. Mutates the input proto_object to update the specified field name to the</span>
<span class="sd">        provided value.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">field_attr</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">proto_object</span><span class="p">,</span> <span class="n">attribute_name</span><span class="p">)</span>
    <span class="n">field_type</span> <span class="o">=</span> <span class="nb">type</span><span class="p">(</span><span class="n">field_attr</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
    <span class="n">field_attr</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">field_type</span><span class="p">(</span><span class="n">attribute_value</span><span class="p">)</span></div>


<div class="viewcode-block" id="handle_nested_double_value_params"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.handle_nested_double_value_params">[docs]</a><span class="k">def</span> <span class="nf">handle_nested_double_value_params</span><span class="p">(</span><span class="n">proto_object</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">attribute_value</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Helper function to set a field to a DoubleValue protobuf in a protobuf message.</span>

<span class="sd">    Args:</span>
<span class="sd">        proto_object (Protobuf message): Any generic protobuf message.</span>
<span class="sd">        name (String): The field name within the protobuf message. This name should</span>
<span class="sd">            be both the field name and sub-field name separated by a period. For example,</span>
<span class="sd">            for the Vec3 velocity field, the name would be &#39;velocity.x&#39;.</span>
<span class="sd">        attribute_value: A value with type matching the field type defined in the protobuf</span>
<span class="sd">            message definition. This will be saved in the attribute_name field.</span>

<span class="sd">    Returns:</span>
<span class="sd">        Nothing. Mutates the input proto_object to update the specified field name to the</span>
<span class="sd">        provided value.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">subfields</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">)</span>
    <span class="n">current_attr</span> <span class="o">=</span> <span class="n">proto_object</span>
    <span class="k">for</span> <span class="n">field</span> <span class="ow">in</span> <span class="n">subfields</span><span class="p">:</span>
        <span class="n">current_attr</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">current_attr</span><span class="p">,</span> <span class="n">field</span><span class="p">)</span>
    <span class="n">current_attr</span><span class="o">.</span><span class="n">CopyFrom</span><span class="p">(</span><span class="n">wrappers_pb2</span><span class="o">.</span><span class="n">DoubleValue</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="n">attribute_value</span><span class="p">))</span></div>


<div class="viewcode-block" id="read_animation_params"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.read_animation_params">[docs]</a><span class="k">def</span> <span class="nf">read_animation_params</span><span class="p">(</span><span class="n">animation</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Parses the set of lines that are the parameters section of the file.</span>

<span class="sd">    Reads the parameter lines into the min/max/default values in the Animation proto.</span>

<span class="sd">    Args:</span>
<span class="sd">        animation (Animation): The animation class structure containing the parameter lines.</span>

<span class="sd">    Returns:</span>
<span class="sd">        The mutated animation class, which now contains populated params fields in the</span>
<span class="sd">        animation&#39;s protobuf.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">current_params_default</span> <span class="o">=</span> <span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">default_parameters</span>
    <span class="n">current_params_min</span> <span class="o">=</span> <span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">minimum_parameters</span>
    <span class="n">current_params_max</span> <span class="o">=</span> <span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">maximum_parameters</span>
    <span class="n">group_field_splitter</span> <span class="o">=</span> <span class="s2">&quot;.&quot;</span>
    <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">animation</span><span class="o">.</span><span class="n">parameter_lines</span><span class="p">:</span>
        <span class="n">split_line</span> <span class="o">=</span> <span class="n">param</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
        <span class="n">param_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">split_line</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="n">min_max_default_vals</span> <span class="o">=</span> <span class="p">[</span>
            <span class="nb">float</span><span class="p">(</span><span class="n">split_line</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">if</span> <span class="nb">float</span><span class="p">(</span><span class="n">split_line</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="o">!=</span> <span class="mi">0</span> <span class="k">else</span> <span class="mf">1e-6</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
        <span class="p">]</span>

        <span class="c1"># Now create the parameter protobuf message.</span>
        <span class="k">if</span> <span class="n">group_field_splitter</span> <span class="ow">in</span> <span class="n">param_name</span><span class="p">:</span>
            <span class="c1"># Non-individual fields, so handle slightly differently.</span>
            <span class="k">try</span><span class="p">:</span>
                <span class="n">handle_nested_double_value_params</span><span class="p">(</span><span class="n">current_params_min</span><span class="p">,</span> <span class="n">param_name</span><span class="p">,</span>
                                                  <span class="n">min_max_default_vals</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="n">handle_nested_double_value_params</span><span class="p">(</span><span class="n">current_params_default</span><span class="p">,</span> <span class="n">param_name</span><span class="p">,</span>
                                                  <span class="n">min_max_default_vals</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                <span class="n">handle_nested_double_value_params</span><span class="p">(</span><span class="n">current_params_max</span><span class="p">,</span> <span class="n">param_name</span><span class="p">,</span>
                                                  <span class="n">min_max_default_vals</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
            <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span>
                <span class="n">err</span> <span class="o">=</span> <span class="s2">&quot;Cannot parse file </span><span class="si">%s</span><span class="s2">: unknown parameter field name </span><span class="si">%s</span><span class="s2">.&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">animation</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
                                                                                  <span class="n">param_name</span><span class="p">)</span>
                <span class="k">raise</span> <span class="n">AnimationFileFormatError</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="c1"># Individual field using a DoubleValue proto.</span>
            <span class="k">try</span><span class="p">:</span>
                <span class="n">set_proto</span><span class="p">(</span><span class="n">current_params_min</span><span class="p">,</span> <span class="n">param_name</span><span class="p">,</span> <span class="n">min_max_default_vals</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="n">set_proto</span><span class="p">(</span><span class="n">current_params_default</span><span class="p">,</span> <span class="n">param_name</span><span class="p">,</span> <span class="n">min_max_default_vals</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                <span class="n">set_proto</span><span class="p">(</span><span class="n">current_params_max</span><span class="p">,</span> <span class="n">param_name</span><span class="p">,</span> <span class="n">min_max_default_vals</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
            <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span>
                <span class="n">err</span> <span class="o">=</span> <span class="s2">&quot;Cannot parse file </span><span class="si">%s</span><span class="s2">: unknown parameter field name </span><span class="si">%s</span><span class="s2">.&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">animation</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
                                                                                  <span class="n">param_name</span><span class="p">)</span>
                <span class="k">raise</span> <span class="n">AnimationFileFormatError</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">animation</span></div>


<div class="viewcode-block" id="read_and_find_animation_params"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.read_and_find_animation_params">[docs]</a><span class="k">def</span> <span class="nf">read_and_find_animation_params</span><span class="p">(</span><span class="n">animate_move_params_file</span><span class="p">,</span> <span class="n">filepath_input</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Create a mapping of the parameter name to the default parameter values.</span>

<span class="sd">    Args:</span>
<span class="sd">        animate_move_params_file (string): filepath to the default parameters file, or a string representing the contents</span>
<span class="sd">            of the parameters file.</span>
<span class="sd">        filepath_input (boolean): With filepath_input set to True, the animate_move_params_file argument will be interpreted as</span>
<span class="sd">            a file path to the default parameters file. When set to False, the animate_move_params_file argument will be read as</span>
<span class="sd">            the information in the default parameters file passed as a string.</span>

<span class="sd">    Returns:</span>
<span class="sd">        A dictionary containing the parameter name as the key, and the full parameter line from</span>
<span class="sd">        the file as the value.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">filepath_input</span><span class="p">):</span>
        <span class="c1">#if animate_move_params_file is a filepath open the file</span>
        <span class="n">params_file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">animate_move_params_file</span><span class="p">,</span> <span class="s2">&quot;r&quot;</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="c1">#if animate_move_params_file is a string of parameter information split the string by newline characters</span>
        <span class="n">params_file</span> <span class="o">=</span> <span class="n">animate_move_params_file</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()</span>

    <span class="n">reading_animate_params</span> <span class="o">=</span> <span class="kc">False</span>
    <span class="n">animate_params_vals</span> <span class="o">=</span> <span class="p">{}</span>
    <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">params_file</span><span class="p">:</span>
        <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
        <span class="k">if</span> <span class="s2">&quot;animate_params&quot;</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
            <span class="c1"># Starting the animate params section.</span>
            <span class="n">reading_animate_params</span> <span class="o">=</span> <span class="kc">True</span>
            <span class="k">continue</span>

        <span class="k">if</span> <span class="n">reading_animate_params</span> <span class="ow">and</span> <span class="n">line</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span><span class="p">:</span>
            <span class="c1"># Finished reading the animate_params section.</span>
            <span class="n">reading_animate_params</span> <span class="o">=</span> <span class="kc">False</span>
            <span class="k">return</span> <span class="n">animate_params_vals</span>

        <span class="k">if</span> <span class="n">reading_animate_params</span><span class="p">:</span>
            <span class="c1"># Set the parameter name as the key, and the full parameter line (as a string) as the value in</span>
            <span class="c1"># the animate_params_vals dictionary.</span>
            <span class="n">split_line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
            <span class="n">param_name</span> <span class="o">=</span> <span class="n">split_line</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="n">animate_params_vals</span><span class="p">[</span><span class="n">param_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">line</span>
            <span class="k">continue</span>
    <span class="k">return</span> <span class="n">animate_params_vals</span></div>


<div class="viewcode-block" id="convert_animation_file_to_proto"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.convert_animation_file_to_proto">[docs]</a><span class="k">def</span> <span class="nf">convert_animation_file_to_proto</span><span class="p">(</span><span class="n">animated_file</span><span class="p">,</span> <span class="n">animate_move_params_file</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Parses a file into the animation proto that will be uploaded to the robot.</span>

<span class="sd">    Args:</span>
<span class="sd">        animated_file (string): The filepath to the animation text file.</span>
<span class="sd">        animate_move_params_file (string): [Required if needing default param values. Otherwise optional]</span>
<span class="sd">            The filepath to a default set of move parameters or move parameters as a string.</span>

<span class="sd">    Returns:</span>
<span class="sd">        The Animation class, which contains the animation proto to be uploaded to the robot, as well</span>
<span class="sd">        as additional information to be used by Choreographer.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="c1"># Create a mapping of the default values for each parameter from the MoveParamsConfig.txt file.</span>
    <span class="c1"># These will be used if a user doesn&#39;t provide min/max/default, but does include the parameter</span>
    <span class="c1"># name in the file.</span>
    <span class="n">maybe_use_default_params</span> <span class="o">=</span> <span class="n">animate_move_params_file</span> <span class="o">!=</span> <span class="s2">&quot;&quot;</span>
    <span class="n">default_animate_params_values</span> <span class="o">=</span> <span class="p">{}</span>
    <span class="k">if</span> <span class="n">maybe_use_default_params</span><span class="p">:</span>
        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">animate_move_params_file</span><span class="p">):</span>
            <span class="c1"># if there is a file at the location animate_move_params_file try to read the file</span>
            <span class="n">default_animate_params_values</span> <span class="o">=</span> <span class="n">read_and_find_animation_params</span><span class="p">(</span><span class="n">animate_move_params_file</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="c1"># if animate_move_params_file isn&#39;t a locatable file try to read the string as parameter field data</span>
            <span class="n">default_animate_params_values</span> <span class="o">=</span> <span class="n">read_and_find_animation_params</span><span class="p">(</span>
                <span class="n">animate_move_params_file</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>

    <span class="n">animation</span> <span class="o">=</span> <span class="n">Animation</span><span class="p">()</span>
    <span class="n">animation</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">ntpath</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">animated_file</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;.cha&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>

    <span class="n">animation_specs</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">animated_file</span><span class="p">,</span> <span class="s2">&quot;r&quot;</span><span class="p">)</span>

    <span class="c1"># Expecting three chunks, separated by a blank line.</span>
    <span class="n">section_counter</span> <span class="o">=</span> <span class="mi">0</span>

    <span class="c1"># The set of keywords that describe each column in the movement section.</span>
    <span class="n">movement_columns</span> <span class="o">=</span> <span class="p">[]</span>

    <span class="c1"># If the keyframe needs the timestamps set based off the frequency, track that information here.</span>
    <span class="c1"># Value 1: indicates if it needs the timestamps set, value 2: indicates the current cumulative time</span>
    <span class="c1"># summed while iterating over each keyframe in the file.</span>
    <span class="n">set_keyframe_times</span> <span class="o">=</span> <span class="p">[</span><span class="kc">False</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span>

    <span class="c1"># Make up a unique color that is persistent based on the animation name.</span>
    <span class="n">name_hash</span> <span class="o">=</span> <span class="n">hashlib</span><span class="o">.</span><span class="n">md5</span><span class="p">(</span><span class="n">animation</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">encode</span><span class="p">())</span>
    <span class="n">animation</span><span class="o">.</span><span class="n">rgb</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">name_hash</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()[</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>
    <span class="n">animation</span><span class="o">.</span><span class="n">rgb</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">name_hash</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>
    <span class="n">animation</span><span class="o">.</span><span class="n">rgb</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">name_hash</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()[</span><span class="mi">4</span><span class="p">:</span><span class="mi">6</span><span class="p">],</span> <span class="mi">16</span><span class="p">)</span>

    <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">animation_specs</span><span class="p">:</span>
        <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>

        <span class="k">if</span> <span class="n">line</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span><span class="p">:</span>
            <span class="c1"># The sections are separated by an empty line</span>
            <span class="n">section_counter</span> <span class="o">+=</span> <span class="mi">1</span>
            <span class="k">continue</span>

        <span class="c1"># Check if there are any comments. Comments can be both at the end of an existing line, or</span>
        <span class="c1"># on a line of their own. They are marked with # or //. We want to just ignore them and continue</span>
        <span class="c1"># parsing the file as normal.</span>
        <span class="k">for</span> <span class="n">delim</span> <span class="ow">in</span> <span class="n">COMMENT_DELIMITERS</span><span class="p">:</span>
            <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">delim</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>  <span class="c1"># Take any content before the comment starts.</span>

        <span class="k">if</span> <span class="n">line</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span><span class="p">:</span>
            <span class="c1"># If after stripping all the comment content there is no line left, then continue.</span>
            <span class="c1"># We do NOT increment the section counter for comment lines!</span>
            <span class="k">continue</span>

        <span class="k">if</span> <span class="n">section_counter</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="c1"># the first section is the &quot;options section&quot;.</span>
            <span class="c1"># Take first word of line and use that as the options keyword. Apply whatever function</span>
            <span class="c1"># is specified for that keyword to the remaining line values.</span>
            <span class="n">file_line_split</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
            <span class="n">keyword</span> <span class="o">=</span> <span class="n">file_line_split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">keyword</span> <span class="ow">in</span> <span class="n">OPTIONS_KEYWORDS_TO_FUNCTION</span><span class="p">:</span>
                <span class="c1"># Apply the keywords functionality to the animation class.</span>
                <span class="n">OPTIONS_KEYWORDS_TO_FUNCTION</span><span class="p">[</span><span class="n">keyword</span><span class="p">](</span><span class="n">file_line_split</span><span class="p">,</span> <span class="n">animation</span><span class="p">)</span>

        <span class="k">elif</span> <span class="n">section_counter</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="c1"># Second section represents the parameters for choreographer. Simply store the lines</span>
            <span class="c1"># for use by choreographer&#39;s config reader.</span>
            <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
            <span class="k">if</span> <span class="s2">&quot;no parameters&quot;</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
                <span class="c1"># This is the keyword for no parameters, so just skip the section and move on.</span>
                <span class="k">continue</span>
            <span class="n">split_line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">split_line</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">maybe_use_default_params</span><span class="p">:</span>
                <span class="c1"># If the parameter name was provided with no user-specified min/max/default values,</span>
                <span class="c1"># then attempt to use the default values from MoveParamsConfig.txt.</span>
                <span class="k">if</span> <span class="n">split_line</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="n">default_animate_params_values</span><span class="p">:</span>
                    <span class="n">animation</span><span class="o">.</span><span class="n">parameter_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">default_animate_params_values</span><span class="p">[</span><span class="n">split_line</span><span class="p">[</span><span class="mi">0</span><span class="p">]])</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">err</span> <span class="o">=</span> <span class="s2">&quot;Cannot parse file </span><span class="si">%s</span><span class="s2">: parameter field name </span><span class="si">%s</span><span class="s2"> was provided but is not a default parameter.&quot;</span> <span class="o">%</span> <span class="p">(</span>
                        <span class="n">animation</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">split_line</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                    <span class="k">raise</span> <span class="n">AnimationFileFormatError</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">animation</span><span class="o">.</span><span class="n">parameter_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>

        <span class="k">elif</span> <span class="n">section_counter</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="c1"># The final section is the animated moves section.</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">movement_columns</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                <span class="c1"># The first line will contain all the different column headers.</span>
                <span class="n">movement_columns</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>

                <span class="c1"># If &quot;time&quot; is not in the column, then we should set that for every keyframe based on frequency</span>
                <span class="k">if</span> <span class="s2">&quot;time&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">movement_columns</span><span class="p">:</span>
                    <span class="n">set_keyframe_times</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
                    <span class="k">if</span> <span class="n">animation</span><span class="o">.</span><span class="n">frequency</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                        <span class="n">prefix</span> <span class="o">=</span> <span class="s2">&quot;Cannot parse file </span><span class="si">%s</span><span class="s2">: &quot;</span> <span class="o">%</span> <span class="n">animation</span><span class="o">.</span><span class="n">name</span>
                        <span class="n">err</span> <span class="o">=</span> <span class="n">prefix</span> <span class="o">+</span> <span class="s2">&quot;Either frequency or keyframe timestamps must be provided. Neither were found.&quot;</span>
                        <span class="k">raise</span> <span class="n">AnimationFileFormatError</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
                <span class="k">continue</span>

            <span class="n">vals</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
            <span class="n">animation_keyframe</span> <span class="o">=</span> <span class="n">choreography_sequence_pb2</span><span class="o">.</span><span class="n">AnimationKeyframe</span><span class="p">()</span>
            <span class="n">current_index</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="k">for</span> <span class="n">header</span> <span class="ow">in</span> <span class="n">movement_columns</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">header</span> <span class="ow">in</span> <span class="n">GROUPED_HEADERS</span><span class="p">:</span>
                    <span class="c1"># For grouped headers, get the next N line values, where N is specified by the grouped</span>
                    <span class="c1"># headers dict, and set those in the animation keyframe protobuf message.</span>
                    <span class="n">header_activities</span> <span class="o">=</span> <span class="n">GROUPED_HEADERS</span><span class="p">[</span><span class="n">header</span><span class="p">]</span>
                    <span class="n">header_values</span> <span class="o">=</span> <span class="n">vals</span><span class="p">[</span><span class="n">current_index</span><span class="p">:</span><span class="n">current_index</span> <span class="o">+</span>
                                         <span class="n">header_activities</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>  <span class="c1"># not inclusive</span>
                    <span class="n">header_values</span> <span class="o">=</span> <span class="p">[</span><span class="nb">float</span><span class="p">(</span><span class="n">val</span><span class="p">)</span> <span class="k">if</span> <span class="n">val</span> <span class="o">!=</span> <span class="s1">&#39;0&#39;</span> <span class="k">else</span> <span class="mf">1e-6</span> <span class="k">for</span> <span class="n">val</span> <span class="ow">in</span> <span class="n">header_values</span><span class="p">]</span>
                    <span class="n">header_activities</span><span class="p">[</span><span class="mi">1</span><span class="p">](</span><span class="n">header_values</span><span class="p">,</span> <span class="n">animation_keyframe</span><span class="p">)</span>
                    <span class="n">current_index</span> <span class="o">=</span> <span class="n">current_index</span> <span class="o">+</span> <span class="n">header_activities</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                <span class="k">elif</span> <span class="n">header</span> <span class="ow">in</span> <span class="n">SINGLE_HEADERS</span><span class="p">:</span>
                    <span class="c1"># Add the single value into the animation keyframe protobuf message.</span>
                    <span class="n">header_value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">vals</span><span class="p">[</span><span class="n">current_index</span><span class="p">])</span>
                    <span class="k">if</span> <span class="n">header_value</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                        <span class="n">header_value</span> <span class="o">=</span> <span class="mf">1e-6</span>
                    <span class="n">SINGLE_HEADERS</span><span class="p">[</span><span class="n">header</span><span class="p">](</span><span class="n">header_value</span><span class="p">,</span> <span class="n">animation_keyframe</span><span class="p">)</span>
                    <span class="n">current_index</span> <span class="o">+=</span> <span class="mi">1</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="c1"># Don&#39;t fail silently and mismatch indices of other groups if one group header is not found.</span>
                    <span class="n">err</span> <span class="o">=</span> <span class="s2">&quot;Cannot parse file </span><span class="si">%s</span><span class="s2">: Unknown body movement keyword </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span>
                        <span class="n">animation</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">header</span><span class="p">)</span>
                    <span class="k">raise</span> <span class="n">AnimationFileFormatError</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>

            <span class="k">if</span> <span class="n">set_keyframe_times</span><span class="p">[</span><span class="mi">0</span><span class="p">]:</span>
                <span class="c1"># Update the timestamp in the keyframe, then increment it based on the frequency</span>
                <span class="n">animation_keyframe</span><span class="o">.</span><span class="n">time</span> <span class="o">=</span> <span class="n">set_keyframe_times</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
                <span class="n">set_keyframe_times</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+=</span> <span class="p">(</span><span class="mf">1.0</span> <span class="o">/</span> <span class="n">animation</span><span class="o">.</span><span class="n">frequency</span><span class="p">)</span>

            <span class="c1"># Add the animation frame into the animation proto.</span>
            <span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">animation_keyframes</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="n">animation_keyframe</span><span class="p">])</span>

        <span class="k">else</span><span class="p">:</span>
            <span class="c1"># An animation file should only have 3 sections: the options, the parameters, and the body movement keyframes.</span>
            <span class="n">err</span> <span class="o">=</span> <span class="p">(</span>
                <span class="s2">&quot;Cannot parse file </span><span class="si">%s</span><span class="s2">: Animation file contains more than 3 sections delineated by whitespace.&quot;</span>
                <span class="s2">&quot; Make sure all comments are included in a existing section.&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">animation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
            <span class="k">raise</span> <span class="n">AnimationFileFormatError</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>

    <span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">animation</span><span class="o">.</span><span class="n">name</span>
    <span class="k">if</span> <span class="n">animation</span><span class="o">.</span><span class="n">bpm</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="o">.</span><span class="n">bpm</span> <span class="o">=</span> <span class="n">animation</span><span class="o">.</span><span class="n">bpm</span>

    <span class="c1"># Read out the parameters into protobuf messages.</span>
    <span class="n">read_animation_params</span><span class="p">(</span><span class="n">animation</span><span class="p">)</span>

    <span class="k">return</span> <span class="n">animation</span></div>


<div class="viewcode-block" id="write_animation_to_dest"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.write_animation_to_dest">[docs]</a><span class="k">def</span> <span class="nf">write_animation_to_dest</span><span class="p">(</span><span class="n">animation</span><span class="p">,</span> <span class="n">destination</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;Write the new animation proto to a .cap file.</span>

<span class="sd">    Args:</span>
<span class="sd">        animation(Animation class): The animation class object generated by the</span>
<span class="sd">            `cha` file conversion helpers to save the protobuf from.</span>
<span class="sd">        destination (string): The full filepath to the location to save the animation</span>
<span class="sd">            protobuf message.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">animation</span><span class="o">.</span><span class="n">name</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">):</span>
        <span class="n">LOGGER</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Invalid file name, cannot save choreography sequence.&quot;</span><span class="p">)</span>
        <span class="k">raise</span> <span class="ne">IOError</span><span class="p">(</span><span class="s2">&quot;Invalid file name, cannot save choreography sequence.&quot;</span><span class="p">)</span>

    <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">destination</span><span class="p">):</span>
        <span class="n">LOGGER</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Path(</span><span class="si">%s</span><span class="s2">) to save file does not exist. Creating it.&quot;</span> <span class="o">%</span> <span class="n">destination</span><span class="p">)</span>
        <span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">destination</span><span class="p">,</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

    <span class="n">animation_proto_bytes</span> <span class="o">=</span> <span class="n">text_format</span><span class="o">.</span><span class="n">MessageToString</span><span class="p">(</span><span class="n">animation</span><span class="o">.</span><span class="n">proto</span><span class="p">)</span>
    <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">destination</span><span class="p">,</span> <span class="n">animation</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s2">&quot;.cap&quot;</span><span class="p">)),</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
        <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">animation_proto_bytes</span><span class="p">)</span></div>


<div class="viewcode-block" id="main"><a class="viewcode-back" href="../../../../python/bosdyn-choreography-client/src/bosdyn/choreography/client/animation_file_to_proto.html#bosdyn.choreography.client.animation_file_to_proto.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
    <span class="n">parser</span> <span class="o">=</span> <span class="n">argparse</span><span class="o">.</span><span class="n">ArgumentParser</span><span class="p">()</span>
    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">&#39;--cha-filepath&#39;</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s1">&#39;The filename of the animation file.&#39;</span><span class="p">)</span>
    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">&#39;--cha-directory&#39;</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span><span class="s2">&quot;The filepath to a directory with animation files.&quot;</span><span class="p">)</span>
    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span>
        <span class="s1">&#39;--config-filepath&#39;</span><span class="p">,</span> <span class="n">help</span><span class="o">=</span>
        <span class="s1">&#39;The filepath for a move params config file. This can be found using the ListAllMoves RPC.&#39;</span><span class="p">,</span>
        <span class="n">default</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
    <span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s1">&#39;--destination-filepath&#39;</span><span class="p">,</span>
                        <span class="n">help</span><span class="o">=</span><span class="s1">&#39;The file location to save the animation proto.&#39;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;.&quot;</span><span class="p">)</span>
    <span class="n">options</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">()</span>

    <span class="k">if</span> <span class="n">options</span><span class="o">.</span><span class="n">cha_filepath</span><span class="p">:</span>
        <span class="n">animation</span> <span class="o">=</span> <span class="n">convert_animation_file_to_proto</span><span class="p">(</span><span class="n">options</span><span class="o">.</span><span class="n">cha_filepath</span><span class="p">,</span> <span class="n">options</span><span class="o">.</span><span class="n">config_filepath</span><span class="p">)</span>
        <span class="n">write_animation_to_dest</span><span class="p">(</span><span class="n">animation</span><span class="p">,</span> <span class="n">options</span><span class="o">.</span><span class="n">destination_filepath</span><span class="p">)</span>

    <span class="k">elif</span> <span class="n">options</span><span class="o">.</span><span class="n">cha_directory</span><span class="p">:</span>
        <span class="n">files_in_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">options</span><span class="o">.</span><span class="n">cha_directory</span><span class="p">)</span>
        <span class="k">for</span> <span class="n">filename</span> <span class="ow">in</span> <span class="n">files_in_dir</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">filename</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&quot;.cha&quot;</span><span class="p">):</span>
                <span class="n">animation</span> <span class="o">=</span> <span class="n">convert_animation_file_to_proto</span><span class="p">(</span>
                    <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">options</span><span class="o">.</span><span class="n">cha_directory</span><span class="p">,</span> <span class="n">filename</span><span class="p">),</span> <span class="n">options</span><span class="o">.</span><span class="n">config_filepath</span><span class="p">)</span>
                <span class="n">write_animation_to_dest</span><span class="p">(</span><span class="n">animation</span><span class="p">,</span> <span class="n">options</span><span class="o">.</span><span class="n">destination_filepath</span><span class="p">)</span>

    <span class="k">else</span><span class="p">:</span>
        <span class="nb">print</span><span class="p">(</span>
            <span class="s2">&quot;Please provide either the --cha-filepath argument for a single animation file, or the --cha-directory argument&quot;</span>
            <span class="s2">&quot; for a full directory of animation files.&quot;</span><span class="p">)</span>

    <span class="k">return</span> <span class="kc">True</span></div>


<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="n">main</span><span class="p">():</span>
        <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
</pre></div>

           </div>
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
      
      &copy; Copyright 2025 Boston Dynamics. All rights reserved.
      <a href="https://www.bostondynamics.com/privacy-policy">Privacy Policy</a> | 
      <a href="https://www.bostondynamics.com/terms">Terms of Use</a>

    </p>
  </div> 

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(false);
      });
  </script>
    <!-- Theme Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'UA-XXXXXXX-1', {
          'anonymize_ip': false,
      });
    </script> 

</body>
</html>